package com.glela.order.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.glela.order.dao.OrderTokenDao;
import com.glela.order.mapper.OrderTokenMapper;
import com.glela.order.model.OrderToken;

@Repository
public class OrderTokenDaoImpl implements OrderTokenDao {
	@Autowired
	private OrderTokenMapper orderTokenMapper;

	@Override
	public OrderToken selectById(String orderKey) {
		return orderTokenMapper.selectByPrimaryKey(orderKey);
	}

	@Override
	public int updateTokeByStatus(String orderKey, int status_new, int status_old) {
		return orderTokenMapper.updateByIdAndStauts(orderKey, status_new, status_old);
	}

	@Override
	public int saveToken(OrderToken addOrderToken) {
		return orderTokenMapper.insert(addOrderToken);
	}

	@Override
	public int delete(String tokenKey) {
		return orderTokenMapper.deleteByPrimaryKey(tokenKey);
	}
}